﻿using CommandProcessor.Dispatcher;
using Data.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PagedList;
using AutoMapper;
using QuanLySanXuat.Models;
using Domain.Commands;
using Core.Common;
using Core.Extensions;
using Data.Models;
namespace QuanLySanXuat.Controllers
{
    public class LoginController : Controller
    {
        //private readonly ErpEntities _db = new ErpEntities();
        //
        // GET: /Login/

        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Registration()
        {
            return View();
        }

        public ActionResult ChangePassword()
        {
            return null;
        }
        [HttpPost]
        public string ChangePass(int id, string oldPass, string newpass)
        {
            return "";
        }

        [HttpPost]
        public string CheckLogin(string username, string password)
        {
            string result = "success";
            try
            {
                if (!username.ToLower().Equals("admin") || !password.Equals("123456"))
                    result = "Sai mật khẩu hoặc tên đăng nhập!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            return result;
        }

        [HttpPost]
        public ActionResult Logout()
        {
            return RedirectToAction("Index", "Login");
        }
    }
}
